Skip to content

LTAR-420: report the failed bstackStep as the test failure; skip setSessionStatus executor on LTS - #4

Merged
MihirR-BS merged 2 commits into
MihirR-BS:lts-nightwatch-rengg-ltsfrom
sanath-browserstack:LTAR-420-lts-step-failure-rengg
Oct 22, 2026
Merged

MihirR-BS merged 2 commits into
MihirR-BS:lts-nightwatch-rengg-ltsfrom
sanath-browserstack:LTAR-420-lts-step-failure-rengg

Conversation

@sanath-browserstack

Copy link
Copy Markdown

Summary

Regression (rengg-lts) counterpart of nightwatchjs#66, for LTAR-420. Same two LTS-only changes, cherry-picked onto lts-nightwatch-rengg-lts:

  1. Report the failed bstackStep() as the test failure. LCNC specs throw their own Error from the step helper, which Nightwatch keeps out of testcase.commands. sendTestRunEvent then took an internal selector probe (executeAsyncScript "script timeout", result {status: -1, value: null}) as the failure and uploaded failure: [{backtrace: ['', '']}], so TestHub could not cluster unique errors; with no failed command the test was reported passed. On LTS runs the last failed step in global.__bstack_steps is now the failure.
  2. Skip the setSessionStatus executor on LTS runs. The LTS grid does not intercept browserstack_executor; Chrome evaluates it as JS and fails with Unexpected token ':' after every test, which then lands in failure evidence as a script syntax error.

Differences from nightwatchjs#66

Verification

  • npm test: 144 passing (136 on the base branch + 8 new). The one failure (getBuildName → "returns empty for empty options") fails identically on the base branch; it asserts the checkout directory name.
  • eslint nightwatch src test --quiet: clean.
  • End-to-end (upstream branch, real Nightwatch + chromedriver): timed-out probes → failed with the step's "No selector matched…" message instead of ['', '']; clean probes → failed instead of passed; passing test → no Unexpected token errors; non-LTS runs unchanged.

…nStatus executor on LTS

LCNC specs throw their own Error from the step helper, which Nightwatch keeps
out of the command list. The first failed command was then an internal
selector probe (executeAsyncScript "script timeout") whose result has no
message or stack, so TestRunFinished shipped failure.backtrace ['', ''] and
TestHub could not cluster unique errors. When no command failed at all, the
test was reported as passed. On LTS runs the last failed step in
global.__bstack_steps is now the authoritative failure.

The setSessionStatus browserstack_executor call is skipped on LTS runs: the
LTS grid does not intercept it, Chrome evaluates it as JS and it fails with
"Unexpected token ':'" after every test.
LTS runs no longer send the setSessionStatus executor, so the test's pause on
browser.execute never happened and the finish completed before the signal.
afterEachExecution is the handler's last await before the stop check.
@MihirR-BS
MihirR-BS merged commit 5b3a1c6 into MihirR-BS:lts-nightwatch-rengg-lts Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants